Skip to content

Fix app freeze on empty search results#40

Merged
wesm merged 1 commit intomainfrom
zero-search-results
Feb 25, 2026
Merged

Fix app freeze on empty search results#40
wesm merged 1 commit intomainfrom
zero-search-results

Conversation

@wesm
Copy link
Copy Markdown
Owner

@wesm wesm commented Feb 25, 2026

Summary

  • Fix command palette freeze when a search query returns zero results (e.g. "spamalot")
  • Root cause: Go nil slice serializes as JSON null, not []. The frontend crashed on null.length, breaking the component and its Escape handler.
  • Server now coerces nil results to an empty slice before serialization
  • Frontend adds ?? [] null-coalesce as defense in depth

Test plan

  • New TestSearch_ZeroResults server test asserts results is [] not null
  • Existing search store tests pass
  • Manual: open command palette, search for a term with no matches, verify "No results" shown and Escape works

Fixes #34

🤖 Generated with Claude Code

The search API returned JSON `null` instead of `[]` when no results
matched, because Go's nil slice serializes as null. The frontend
then crashed on `null.length`, breaking the Escape handler and
freezing the command palette.

Fix: ensure the server handler always returns an empty array.
Add a frontend null-coalesce guard as defense in depth.

Fixes #34

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@roborev-ci
Copy link
Copy Markdown

roborev-ci bot commented Feb 25, 2026

roborev: Combined Review (b847e64)

Verdict: All reviewers agree the code is clean and introduces no functional or security issues.

The changes successfully normalize empty search results from null to [] across both the frontend and backend, preventing application freezes and ensuring consistent data handling. No medium, high, or critical vulnerabilities or defects
were found.


Synthesized from 4 reviews (agents: codex, gemini | types: default, security)

@wesm wesm merged commit 7841db5 into main Feb 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App freeze on empty search result

1 participant